home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
pas_all.zip
/
TI118.ASC
< prev
next >
Wrap
Text File
|
1992-08-12
|
3KB
|
133 lines
PRODUCT : TURBO PASCAL NUMBER : 118
VERSION : 2.00x
OS : PC-DOS, MS-DOS
DATE : March 13, 1986 PAGE : 1/2
TITLE : REDIRECTION OF INPUT/OUTPUT
This program demonstrates user defined INPUT and OUTPUT device
drivers. Use the indicated portion of the sample program as an
INCLUDE file to be inserted in declaration section of your
program files.
The MS-DOS facilities of redirection, piping, and simultaneous
printing through the use of ^P or ^PrtSc will be re-enabled. At
the beginning of your main program, place the statements
(ConInPtr:=Ofs(GetC);) and (ConOutPtr:=Ofs(PutC);). The INPUT and
OU
_________________________________________________________________
START OF INCLUDE FILE
_________________________________________________________________
program Redirect:
Type RegRecord = Record Case Integer Of
1: (AX,BX,CX,DX,BP,SI,DI,DS,ES,Flags: Integer);
2: (AL,AH,BL,BH,CL,CH,DL,DH: Byte);
End;
Var Regs : RegRecord;
Function GetC: Byte;
Begin
Regs.AH:=8;
MsDos(Regs);
GetC:=Regs.AL;
End;
Procedure PutC(C: Byte);
Begin
Regs.AH:=2;
Regs.DL:=C;
MsDos(Regs);
End;
________________________________________________________________
END OF INCLUDE FILE
PRODUCT : TURBO PASCAL NUMBER : 118
VERSION : 2.00x
OS : PC-DOS, MS-DOS
DATE : March 13, 1986 PAGE : 2/2
TITLE : REDIRECTION OF INPUT/OUTPUT
_________________________________________________________________
Var Str : String [255];
I : integer;
Answer : char;
begin
ConInPtr:=Ofs(GetC); { Include these lines at the }
ConOutPtr:=Ofs(PutC); { start of your program }
repeat
ClrScr;
writeln ('This is a test of INPUT/OUTPUT redirection: ');
writeln;
for I := 1 to 128 do { demonstrates formated output }
write (1:5);
writeln; writeln;
writeln ('Enter a String of characters from the keyboard.');
writeln;
readln (Str);
writeln;
writeln (Str);
writeln; writeln;
writeln ('Run again? (Y/N)'); writeln;
writeln ('Type <Ctrl> <P> first to test output to PRINTER/CRT');
repeat
read (kbd,Answer);
until upcase (Answer) in ['Y','N'];
writeln;
writeln;
until upcase (Answer) = 'N';
end.
DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.